<template>
  <div class="Css_login">
      <el-card class="Css_boxCard">
          <div class="Css_boxTitle">
            <h3>欢迎来到汽车家族</h3>
          </div>
          <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
            <el-form-item label="账号" prop="account">
              <el-input v-model="ruleForm.account"></el-input>
            </el-form-item>
          </el-form>
          <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
              <el-form-item label="密码" prop="possword" >
                <el-input v-model="ruleForm.possword" show-password></el-input>
              </el-form-item>
          </el-form>
          <el-form ref="ruleForm" label-width="100px" class="denglu">
              <el-button style="width:100%" type='primary' @click="Login_Enter">登录</el-button>
          </el-form>
      </el-card>
  </div>
</template>

<script>
export default {
  props: {

  },
  data () {
    return {
      ruleForm: {
        account: '',
        possword: ''
      },
      rules: {
        account: [
          { required: true, message: '请输入账号', trigger: 'blur' },
          { min: 3, max: 10, message: '长度在 3 到 10 个英文或数字', trigger: 'blur' },
          { required: true, pattern: /^[A-Za-z0-9]+$/, message: '请输入数字或英文', trigger: 'blur' }
        ],
        possword: [
          { required: true, message: '请输入密码', trigger: 'blur' },
          { min: 5, max: 15, message: '长度在 5 到 15 个英文或数字', trigger: 'blur' },
          { required: true, pattern: /^[A-Za-z0-9]+$/, message: '以字母开头,只能包含字母、数字和下划线,', trigger: 'blur' }
        ]
      }
    }
  },
  computed: {

  },
  created () {

  },
  methods: {
    Login_Enter () {
      console.log(this.ruleForm.account, this.ruleForm.possword)
      this.$api.Login.Login_Enter({
        account: this.ruleForm.account,
        possword: this.ruleForm.possword
      }).then(res => {
        console.log(res)
      })
    }
  },
  mounted () {

  },
  watch: {

  },

  components: {

  }
}
</script>

<style scoped lang="less">
  .Css_login{
    background:url('../../assets/image/login1.jpg') no-repeat;
    background-size: cover;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items:center;
    .Css_boxCard {
      width: 400px;
      display: flex;
      justify-content: center;
      background-color: rgba(254,219,207,0.1);
      .Css_boxTitle {
        text-align: center;
      }
      /deep/.el-form-item__label {
        color: #fff;
      }
    }
    /deep/.el-card__body {
      width: 400px;
    }
  }
</style>
